/*
* @Author: An
* @Date:   2017-07-15 13:18:53
* @Last Modified by:   An
* @Last Modified time: 2017-07-17 11:06:53
*/

'use strict';
var _xj = require('util/xj.js');

var _order = {
	// 获取商品列表
	getProductList : function(resolve, reject) {
		_xj.request({
			url 	: _xj.getServerUrl('/order/get_order_cart_product.do'),
			method	: 'POST',
			success : resolve,
			error 	: reject
		});
	},
	// 提交订单
	createOrder : function(orderInfo, resolve, reject) {
		_xj.request({
			url 	: _xj.getServerUrl('/order/create.do'),
			method	: 'POST',
			data 	: orderInfo,
			success : resolve,
			error 	: reject
		});
	},
	// 获取订单列表
	getOrderList : function(listParam, resolve, reject) {
		_xj.request({
			url 	: _xj.getServerUrl('/order/list.do'),
			method	: 'POST',
			data 	: listParam,
			success : resolve,
			error 	: reject
		});
	},
	// 获取订单详情
	getOrderDetail : function(orderNumber, resolve, reject) {
		_xj.request({
			url 	: _xj.getServerUrl('/order/detail.do'),
			method	: 'POST',
			data 	: {
				orderNo : orderNumber
			},
			success : resolve,
			error 	: reject
		});
	},
	// 取消订单
	cancelOrder : function(orderNumber, resolve, reject) {
		_xj.request({
			url 	: _xj.getServerUrl('/order/cancel.do'),
			method	: 'POST',
			data 	: {
				orderNo : orderNumber
			},
			success : resolve,
			error 	: reject
		});
	}
}
module.exports = _order;